﻿<UserControl x:Class="DataForest.View.TreeView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:data="clr-namespace:DataForest.DataModel" 
             xmlns:converter="clr-namespace:DataForest.View.Converter"
             xmlns:dbo="clr-namespace:System.Data;assembly=system.data"
             mc:Ignorable="d" 
             d:DesignHeight="394.198" d:DesignWidth="667.42" x:Name="this">


    <UserControl.Resources>
        <converter:NodeToEndpointConverter x:Key="NodeToEndpointConverter" TreeView="{Binding ElementName=tvMainTreeView}"/>
        <converter:NodeToMiddlepointConverter x:Key="NodeToMiddlepointConverter" TreeView="{Binding ElementName=tvMainTreeView}"/>
        <converter:NodeToStartpointConverter x:Key="NodeToStartpointConverter" TreeView="{Binding ElementName=tvMainTreeView}"/>
        <converter:NodeToIsSelectedConverter x:Key="NodeToIsSelectedConverter" TreeView="{Binding ElementName=tvMainTreeView}"/>
        <converter:AttributToBrushConverter x:Key="AttributToBrushConverter" Group="{Binding Path=Group}"/>
        <converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
        <converter:PassThroughConverter x:Key="PassThroughConverter" />
        <converter:NotBoolToVisibilityConverter x:Key="NotBoolToVisibilityConverter" />
        <converter:DoubleToStringConverter x:Key="DoubleToStringConverter" />
        <converter:DivideConverter x:Key="DivideConverter" />
        <converter:IsHighlightedConverter x:Key="IsHighlightedConverter" />
        <converter:InverterConverter x:Key="InverterConverter" />
        <converter:ColumnToEntropyConverter x:Key="ColumnToEntropyConverter" />
        
        <Style TargetType="Button" x:Key="ButtonLinkStyle">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <ContentPresenter />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Foreground" Value="Gray" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="FontSize" Value="13" />
            <Setter Property="Cursor" Value="Hand" />
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Foreground" Value="Black" />
                    <Setter Property="FontWeight" Value="Bold" />
                </Trigger>
            </Style.Triggers>
        </Style>
        
        <Style TargetType="TreeViewItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TreeViewItem">
                        <Grid Margin="2" x:Name="nodeContainer"  Panel.ZIndex="20">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                                <Border Canvas.ZIndex="40"  Margin="5" Padding="5" Width="150" x:Name="borderNode" Background="#FFE8E8E8" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="Black" BorderThickness="3" CornerRadius="5">
                                    <Border.InputBindings>
                                        <MouseBinding Command="{Binding DataContext.SelectNodeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" CommandParameter="{Binding}" MouseAction="LeftClick" />
                                    </Border.InputBindings>
                                    <Border.ContextMenu>
                                        <ContextMenu x:Name="cmContextMenu" Background="White">
                                            <ContextMenu.ItemsSource>
                                                <CompositeCollection>
                                                    <MenuItem Header="SplitWert Ändern" Command="{Binding DataContext.ChangeSplitValueCommand, Source={x:Reference this}}"  CommandParameter="{Binding}" Visibility="{Binding IsDiscret, Converter={StaticResource NotBoolToVisibilityConverter}}" />
                                                    <Separator Visibility="{Binding IsDiscret, Converter={StaticResource NotBoolToVisibilityConverter}}" />
                                                <MenuItem Header="Attribut wählen:"  IsEnabled="False" Foreground="Black" Visibility="{Binding DataContext.Tree.AttributAvailable, Converter={StaticResource BoolToVisibilityConverter}, Source={x:Reference this}}" FontWeight="Bold" />
                                                    <CollectionContainer Collection="{Binding DataContext.Tree.AvailableAttributsList, Source={x:Reference this}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
                                                <MenuItem Header="Attribut nach Entropie" Command="{Binding  DataContext.ChooseBestAttributCommand, Source={x:Reference this}}" CommandParameter="{Binding}" Visibility="{Binding DataContext.Tree.AttributAvailable, Converter={StaticResource BoolToVisibilityConverter}, Source={x:Reference this}}" Foreground="Black" FontWeight="Bold" />
                                                <MenuItem Header="Attribut entfernen" Command="{Binding DataContext.RemoveAttributCommand, Source={x:Reference this}}" CommandParameter="{Binding}" Foreground="Black" FontWeight="Bold" >
                                                        <MenuItem.Icon>
                                                            <Image Source="Icons/attribut-delete.png" Width="16" Height="16" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" />
                                                        </MenuItem.Icon>
                                                    </MenuItem>
                                                </CompositeCollection>
                                            </ContextMenu.ItemsSource>
                                            <ContextMenu.Resources>
                                                <DataTemplate DataType="{x:Type dbo:DataColumn}">
                                                    <StackPanel Orientation="Horizontal" Margin="10,0,0,0" Height="16" IsHitTestVisible="True" HorizontalAlignment="Stretch">
                                                        <StackPanel.InputBindings>
                                                            <MouseBinding Command="{Binding  DataContext.SetAttributCommand, Source={x:Reference this}}"  MouseAction="LeftClick">
                                                                <MouseBinding.CommandParameter>
                                                                    <MultiBinding Converter="{StaticResource PassThroughConverter}">
                                                                        <Binding Path="DataContext" Source="{x:Reference nodeContainer}" />
                                                                        <Binding />
                                                                    </MultiBinding>
                                                                </MouseBinding.CommandParameter>
                                                            </MouseBinding>
                                                        </StackPanel.InputBindings>
                                                        <TextBlock Text="Ü " FontFamily="Wingdings" FontSize="13" FontWeight="Bold" RenderOptions.ClearTypeHint="Enabled" />
                                                        <TextBlock Text="{Binding Path=ColumnName}" />
                                                        <TextBlock Text=" (" />
                                                        <TextBlock>
                                                            <TextBlock.Text>
                                                                <MultiBinding Converter="{StaticResource ColumnToEntropyConverter}">
                                                                    <Binding/>
                                                                    <Binding Path="DataContext" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
                                                                </MultiBinding>
                                                            </TextBlock.Text>
                                                        </TextBlock>
                                                    <TextBlock Text=")" />
                                                </StackPanel>
                                                </DataTemplate>
                                            </ContextMenu.Resources>
                                        </ContextMenu>
                                    </Border.ContextMenu>
                                    <Border.ToolTip>
                                        <StackPanel Width="200" IsHitTestVisible="False">
                                            <TextBlock Text="{Binding Attribut.ColumnName}" TextAlignment="Center" Visibility="{Binding IsLeaf, Converter={StaticResource NotBoolToVisibilityConverter}}" FontWeight="Bold" FontSize="13" TextWrapping="Wrap" Foreground="#FFC90B0B" TextTrimming="None" HorizontalAlignment="Stretch" />
                                            <TextBlock Text="{Binding MainTargetValue}" TextAlignment="Center" Visibility="{Binding IsLeaf, Converter={StaticResource BoolToVisibilityConverter}}" FontWeight="Bold" FontSize="13" TextWrapping="Wrap" Foreground="{Binding MainTargetValue, Converter={StaticResource AttributToBrushConverter}}" TextTrimming="None" HorizontalAlignment="Stretch" />
                                            <TextBlock Text="{Binding MainTargetValuePercentage}" TextAlignment="Center" Visibility="{Binding IsLeaf, Converter={StaticResource BoolToVisibilityConverter}}" TextWrapping="Wrap" TextTrimming="None" HorizontalAlignment="Stretch" />
                                            <StackPanel Orientation="Horizontal" Visibility="{Binding IsDiscret, Converter={StaticResource NotBoolToVisibilityConverter}}">
                                                <TextBlock Text="Splitwert: " Width="100"/>
                                                <TextBlock Text="{Binding SplitValue}" />
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Width="100" Text="Objekte:" />
                                                <TextBlock Text="{Binding ObjectCount}"/>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Visibility="{Binding IsLeaf, Converter={StaticResource NotBoolToVisibilityConverter}}">
                                                <TextBlock Width="100" Text="Entropie:" />
                                                <TextBlock Text="{Binding Entropie, Converter={StaticResource DoubleToStringConverter}}"/>
                                            </StackPanel>
                                            <TextBlock Text="Zielattribut Merkmale:" FontWeight="Bold" />
                                            <ItemsControl ItemsSource="{Binding TargetValueCounts}" >
                                                <ItemsControl.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel />
                                                    </ItemsPanelTemplate>
                                                </ItemsControl.ItemsPanel>
                                                <ItemsControl.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <TextBlock Text="{Binding Key}" Width="100" />
                                                            <TextBlock Text="{Binding Value}" />
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ItemsControl.ItemTemplate>
                                            </ItemsControl>
                                        </StackPanel>
                                    </Border.ToolTip>
                                    <StackPanel IsHitTestVisible="False">
                                        <Grid x:Name="nodeGrid">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="70" />
                                                <ColumnDefinition Width="50" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="16" />
                                                <RowDefinition Height="16" />
                                                <RowDefinition Height="16" />
                                                <RowDefinition Height="5" />
                                            </Grid.RowDefinitions>
                                            <TextBlock IsHitTestVisible="False" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"  Text="{Binding Attribut.ColumnName}" TextAlignment="Center" FontWeight="Bold" FontSize="13" TextWrapping="NoWrap" Foreground="#FFC90B0B" TextTrimming="CharacterEllipsis" HorizontalAlignment="Stretch"  />
                                            <TextBlock IsHitTestVisible="False" Grid.Column="0" Grid.Row="1" x:Name="tbCaptionCount" Text="Anzahl:" />
                                            <TextBlock IsHitTestVisible="False" Grid.Column="0" Grid.Row="2" x:Name="tbCaptionEntropy" Text="Entropie:" />
                                            <TextBlock IsHitTestVisible="False" Grid.Column="1" Grid.Row="1" x:Name="tbCount" Text="{Binding ObjectCount}" />
                                            <TextBlock IsHitTestVisible="False" Grid.Column="1" Grid.Row="2" x:Name="tbEntropy" Text="{Binding Entropie, Converter={StaticResource DoubleToStringConverter}}"/>
                                        </Grid>
                                        <Grid x:Name="nodeRulesGrid">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="22" />
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                        <TextBlock IsHitTestVisible="False" Grid.Row="0" x:Name="tbMainTargetValue" Text="{Binding MainTargetValue}" TextAlignment="Center" FontWeight="Bold" FontSize="13" TextWrapping="NoWrap" Foreground="White" Background="{Binding MainTargetValue, Converter={StaticResource AttributToBrushConverter}}" TextTrimming="CharacterEllipsis" HorizontalAlignment="Stretch"/>
                                            <TextBlock IsHitTestVisible="False" Grid.Row="1" x:Name="tbMainTargetValuePercentage" Text="{Binding MainTargetValuePercentage}" TextAlignment="Center" FontSize="13" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Stretch"/>
                                        </Grid>
                                        <Grid x:Name="leafGrid">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="22" />
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                            <TextBlock IsHitTestVisible="False" Grid.Row="0" Text="{Binding MainTargetValue}" TextAlignment="Center" FontWeight="Bold" FontSize="13" TextWrapping="NoWrap" Foreground="White" Background="{Binding MainTargetValue, Converter={StaticResource AttributToBrushConverter}}" TextTrimming="CharacterEllipsis" HorizontalAlignment="Stretch"/>
                                            <TextBlock IsHitTestVisible="False" Grid.Row="1" Text="{Binding MainTargetValuePercentage}" TextAlignment="Center" HorizontalAlignment="Stretch" />
                                            <ItemsControl Grid.Row="1"  ItemsSource="{Binding TargetValueCounts}" Visibility="Collapsed">
                                                <ItemsControl.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel />
                                                    </ItemsPanelTemplate>
                                                </ItemsControl.ItemsPanel>
                                                <ItemsControl.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <TextBlock Width="40" Text="{Binding Key}" />
                                                            <TextBlock Text="{Binding Value}" />
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ItemsControl.ItemTemplate>
                                            </ItemsControl>
                                        </Grid>
                                    </StackPanel>
                                </Border>
                            <ItemsControl Grid.Row="1" ItemsSource="{Binding Path=DataContext.ConnectedNodes, IsAsync=True,  RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}}}" Width="{Binding Path=ActualWidth, ElementName=nodeContainer, UpdateSourceTrigger=PropertyChanged}" Height="30">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <Canvas />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Line Canvas.ZIndex="10" X1="{Binding Me, IsAsync=True, Converter={StaticResource NodeToStartpointConverter}, UpdateSourceTrigger=PropertyChanged}" Y1="-20" X2="{Binding Me, IsAsync=True, Converter={StaticResource NodeToEndpointConverter}, UpdateSourceTrigger=PropertyChanged}" Y2="50" StrokeThickness="2">
                                                <Line.Style>
                                                    <Style TargetType="Line">
                                                        <Setter Property="Stroke" Value="Black" />
                                                        <Style.Triggers>
                                                            <DataTrigger Value="True">
                                                                <DataTrigger.Binding>
                                                                    <MultiBinding Converter="{StaticResource IsHighlightedConverter}">
                                                                        <Binding Path="DataContext.StaticSelectedRow" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}" />
                                                                        <Binding Path="DataContext.ShowRules" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}" />
                                                                        <Binding />
                                                                    </MultiBinding>
                                                                </DataTrigger.Binding>
                                                                <Setter Property="Stroke" Value="Red" />
                                                                <Setter Property="StrokeThickness" Value="3" />
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Line.Style>
                                            </Line>
                                            <TextBlock x:Name="tbValue" Height="18" Width="80" Text="{Binding AttributValue, UpdateSourceTrigger=PropertyChanged}" Margin="{Binding Converter={StaticResource NodeToMiddlepointConverter}}" Opacity="1"  Canvas.ZIndex="40" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" FontWeight="Bold" Background="White">
                                                <TextBlock.Style>
                                                    <Style TargetType="TextBlock">
                                                        <Setter Property="Foreground" Value="Gray" />
                                                        <Style.Triggers>
                                                            <DataTrigger Value="True">
                                                                <DataTrigger.Binding>
                                                                    <MultiBinding Converter="{StaticResource IsHighlightedConverter}">
                                                                        <Binding Path="DataContext.StaticSelectedRow" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}" />
                                                                        <Binding Path="DataContext.ShowRules" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}" />
                                                                        <Binding />
                                                                    </MultiBinding>
                                                                </DataTrigger.Binding>
                                                                <Setter Property="Foreground" Value="Red" />
                                                                <Setter Property="FontSize" Value="13" />
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </TextBlock.Style>
                                            </TextBlock>
                                        </Grid>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>

                            <ItemsPresenter x:Name="itemsChildNodes" Grid.Row="2" >
                            </ItemsPresenter>
                            
                        </Grid>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding IsLeaf, UpdateSourceTrigger=PropertyChanged}" Value="False">
                                <Setter TargetName="leafGrid" Property="Visibility" Value="Collapsed" />
                                <Setter TargetName="nodeGrid" Property="Visibility" Value="Visible" />
                                <Setter TargetName="nodeRulesGrid" Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsLeaf, UpdateSourceTrigger=PropertyChanged}" Value="True">
                                <Setter TargetName="borderNode" Property="Border.CornerRadius" Value="0" />
                                <Setter TargetName="borderNode" Property="Width" Value="80" />
                                <Setter TargetName="leafGrid" Property="Visibility" Value="Visible" />
                                <Setter TargetName="nodeRulesGrid" Property="Visibility" Value="Collapsed" />
                                <Setter TargetName="nodeGrid" Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding DataContext.ShowRules, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="True">
                                <Setter TargetName="borderNode" Property="Width" Value="80" />
                                <Setter TargetName="leafGrid" Property="Visibility" Value="Collapsed" />
                                <Setter TargetName="nodeRulesGrid" Property="Visibility" Value="Visible" />
                                <Setter TargetName="nodeGrid" Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                            <DataTrigger Value="True">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource NodeToIsSelectedConverter}">
                                        <Binding Path="DataContext.SelectedNode" ElementName="this" />
                                        <Binding />
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter TargetName="borderNode" Property="Border.Background" Value="AliceBlue" />
                                <Setter TargetName="borderNode" Property="Border.BorderBrush" Value="Blue" />
                            </DataTrigger>
                            <DataTrigger Value="True">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource IsHighlightedConverter}">
                                        <Binding Path="DataContext.StaticSelectedRow" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}" />
                                        <Binding Path="DataContext.ShowRules" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}" />
                                        <Binding />
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter TargetName="borderNode" Property="Border.BorderBrush" Value="Red" />
                            </DataTrigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>

                </Setter.Value>
            </Setter>
           

            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel HorizontalAlignment="Center" IsItemsHost="True" Margin="4,6" Orientation="Horizontal">
                        </StackPanel>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="333*" />
            <RowDefinition Height="32" />
        </Grid.RowDefinitions>
        <ToggleButton Content="Regeldarstellung" Grid.Row="1" Height="25" Margin="0,4,0,0" Name="button4" VerticalAlignment="Top" IsChecked="{Binding ShowRules, Mode=TwoWay}" IsEnabled="True" ClickMode="Release" HorizontalAlignment="Right" Width="103" />
        <StackPanel Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal">
            <Image Source="Icons/target-attribut.png" Stretch="Fill" Width="18" Height="18" RenderOptions.BitmapScalingMode="HighQuality" />
            <TextBlock Text="Zielattribute: " VerticalAlignment="Center" FontWeight="Bold" />
            <TextBlock Text="{Binding Tree.TargetAttribut.ColumnName}" VerticalAlignment="Center" />
        </StackPanel>
        <ToggleButton Content="Daten anzeigen" Grid.Row="1" Margin="10,4,0,0" HorizontalAlignment="Left" Width="109" Height="25" VerticalAlignment="Top" IsChecked="{Binding IsDataVisible, Mode=TwoWay}" />
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="60*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TreeView Grid.Column="0" x:Name="tvMainTreeView" ItemsSource="{Binding Tree.StartNodeAsList, IsAsync=True}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="White">

                <TreeView.InputBindings>
                    <MouseBinding Command="{Binding SelectNodeCommand}" CommandParameter="{x:Null}" MouseAction="LeftClick" />
                </TreeView.InputBindings>
                <TreeView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid HorizontalAlignment="Center" IsItemsHost="True" />
                    </ItemsPanelTemplate>
                </TreeView.ItemsPanel>
                <TreeView.Resources>
                    <HierarchicalDataTemplate DataType="{x:Type data:Node}" ItemsSource="{Binding ChildNodes}">
                    </HierarchicalDataTemplate>
                </TreeView.Resources>
            </TreeView>
            <Grid Grid.Column="1" Visibility="{Binding IsDataVisible, Converter={StaticResource BoolToVisibilityConverter}}" VerticalAlignment="Stretch" Width="400" Margin="4,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                    <TextBlock Grid.Row="1" Text="Daten:" FontSize="13" FontWeight="Bold" Margin="10,0,0,10"/>
                    <DataGrid Grid.Row="1" Margin="10,24,10,0" SelectedItem="{Binding SelectedRow}" ItemsSource="{Binding SelectedData}" EnableRowVirtualization="False" HorizontalAlignment="Stretch" IsReadOnly="{Binding ShowRules, Converter={StaticResource InverterConverter}}" />
                    <StackPanel Grid.Row="0" Margin="10,0,0,10" Visibility="{Binding Tree.AttributAvailable, Converter={StaticResource BoolToVisibilityConverter}}" >
                    <TextBlock Text="Attribut Wählen:" FontWeight="Bold" FontSize="13" Margin="0,0,0,10"/>
                    <ItemsControl ItemsSource="{Binding Tree.AvailableAttributsList}" Margin="10,0,0,0">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical" >
                                    <Button Style="{StaticResource ButtonLinkStyle}" Command="{Binding DataContext.SetAttributCommand, Source={x:Reference this}}">
                                        <Button.CommandParameter>
                                            <MultiBinding Converter="{StaticResource PassThroughConverter}">
                                                <Binding Path="DataContext.SelectedNode" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}}" />
                                                <Binding />
                                            </MultiBinding>
                                        </Button.CommandParameter>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Ü " FontFamily="Wingdings" FontSize="13" FontWeight="Bold" RenderOptions.ClearTypeHint="Enabled" />
                                            <TextBlock Text="{Binding ColumnName}" Width="200" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" />
                                            <TextBlock Margin="10,0,0,0">
                                                <TextBlock.Text>
                                                    <MultiBinding Converter="{StaticResource ColumnToEntropyConverter}">
                                                        <Binding/>
                                                        <Binding Path="DataContext.SelectedNode" RelativeSource="{RelativeSource AncestorType={x:Type UserControl}}" />
                                                    </MultiBinding>
                                                </TextBlock.Text>
                                            </TextBlock>
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
